home *** CD-ROM | disk | FTP | other *** search
-
-
-
- RESOLVER(3) RESOLVER(3)
-
-
- NNAAMMEE
- res_query, res_search, res_mkquery, res_send, res_init,
- dn_comp, dn_expand - resolver routines
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
- ##iinncclluuddee <<nneettiinneett//iinn..hh>>
- ##iinncclluuddee <<aarrppaa//nnaammeesseerr..hh>>
- ##iinncclluuddee <<rreessoollvv..hh>>
-
- rreess__qquueerryy((ddnnaammee,, ccllaassss,, ttyyppee,, aannsswweerr,, aannsslleenn))
- cchhaarr **ddnnaammee;;
- iinntt ccllaassss,, ttyyppee;;
- uu__cchhaarr **aannsswweerr;;
- iinntt aannsslleenn;;
-
- rreess__sseeaarrcchh((ddnnaammee,, ccllaassss,, ttyyppee,, aannsswweerr,, aannsslleenn))
- cchhaarr **ddnnaammee;;
- iinntt ccllaassss,, ttyyppee;;
- uu__cchhaarr **aannsswweerr;;
- iinntt aannsslleenn;;
-
- rreess__mmkkqquueerryy((oopp,, ddnnaammee,, ccllaassss,, ttyyppee,, ddaattaa,, ddaattaalleenn,, nneewwrrrr,,
- bbuuff,, bbuufflleenn))
- iinntt oopp;;
- cchhaarr **ddnnaammee;;
- iinntt ccllaassss,, ttyyppee;;
- cchhaarr **ddaattaa;;
- iinntt ddaattaalleenn;;
- ssttrruucctt rrrreecc **nneewwrrrr;;
- cchhaarr **bbuuff;;
- iinntt bbuufflleenn;;
-
- rreess__sseenndd((mmssgg,, mmssgglleenn,, aannsswweerr,, aannsslleenn))
- cchhaarr **mmssgg;;
- iinntt mmssgglleenn;;
- cchhaarr **aannsswweerr;;
- iinntt aannsslleenn;;
-
- rreess__iinniitt(())
-
- ddnn__ccoommpp((eexxpp__ddnn,, ccoommpp__ddnn,, lleennggtthh,, ddnnppttrrss,, llaassttddnnppttrr))
- cchhaarr **eexxpp__ddnn,, **ccoommpp__ddnn;;
- iinntt lleennggtthh;;
- cchhaarr ****ddnnppttrrss,, ****llaassttddnnppttrr;;
-
- ddnn__eexxppaanndd((mmssgg,, eeoommoorriigg,, ccoommpp__ddnn,, eexxpp__ddnn,, lleennggtthh))
- cchhaarr **mmssgg,, **eeoommoorriigg,, **ccoommpp__ddnn,, **eexxpp__ddnn;;
- iinntt lleennggtthh;;
-
- DDEESSCCRRIIPPTTIIOONN
- These routines are used for making, sending and interpret-
- ing query and reply messages with Internet domain name
- servers.
-
-
-
- November 11, 1993 1
-
-
-
-
-
- RESOLVER(3) RESOLVER(3)
-
-
- Global configuration and state information that is used by
- the resolver routines is kept in the structure ___r_e_s. Most
- of the values have reasonable defaults and can be ignored.
- Options stored in ___r_e_s_._o_p_t_i_o_n_s are defined in _r_e_s_o_l_v_._h and
- are as follows. Options are stored as a simple bit mask
- containing the bitwise ``or'' of the options enabled.
-
- RES_INIT
- True if the initial name server address and default
- domain name are initialized (i.e., _r_e_s___i_n_i_t has
- been called).
-
- RES_DEBUG
- Print debugging messages.
-
- RES_AAONLY
- Accept authoritative answers only. With this
- option, _r_e_s___s_e_n_d should continue until it finds an
- authoritative answer or finds an error. Currently
- this is not implemented.
-
- RES_USEVC
- Use TCP connections for queries instead of UDP
- datagrams.
-
- RES_STAYOPEN
- Used with RES_USEVC to keep the TCP connection open
- between queries. This is useful only in programs
- that regularly do many queries. UDP should be the
- normal mode used.
-
- RES_IGNTC
- Unused currently (ignore truncation errors, i.e.,
- don't retry with TCP).
-
- RES_RECURSE
- Set the recursion-desired bit in queries. This is
- the default. (_r_e_s___s_e_n_d does not do iterative
- queries and expects the name server to handle
- recursion.)
-
- RES_DEFNAMES
- If set, _r_e_s___s_e_a_r_c_h will append the default domain
- name to single-component names (those that do not
- contain a dot). This option is enabled by default.
-
- RES_DNSRCH
- If this option is set, _r_e_s___s_e_a_r_c_h will search for
- host names in the current domain and in parent
- domains; see _h_o_s_t_n_a_m_e(7). This is used by the
- standard host lookup routine _g_e_t_h_o_s_t_b_y_n_a_m_e(3).
- This option is enabled by default.
-
-
-
-
-
- November 11, 1993 2
-
-
-
-
-
- RESOLVER(3) RESOLVER(3)
-
-
- RES_NOALIASES
- This option turns off the user level aliasing fea-
- ture controlled by the HOSTALIASES environment
- variable. Network daemons should set this option.
-
- The _r_e_s___i_n_i_t routine reads the configuration file (if any;
- see _r_e_s_o_l_v_e_r(5)) to get the default domain name, search
- list and the Internet address of the local name server(s).
- If no server is configured, the host running the resolver
- is tried. The current domain name is defined by the host-
- name if not specified in the configuration file; it can be
- overridden by the environment variable LOCALDOMAIN. This
- environment variable may contain several blank-separated
- tokens if you wish to override the _s_e_a_r_c_h _l_i_s_t on a per-
- process basis. This is similar to the _s_e_a_r_c_h command in
- the configuration file. Another environment variable
- (``RES_OPTIONS'') can be set to override certain internal
- resolver options which are otherwise set by changing
- fields in the ___r_e_s structure or are inherited from the
- configuration file's _o_p_t_i_o_n_s command. The syntax of the
- ``RES_OPTIONS'' environment variable is explained in
- _r_e_s_o_l_v_e_r(5). Initialization normally occurs on the first
- call to one of the other resolver routines.
-
- The _r_e_s___q_u_e_r_y function provides an interface to the server
- query mechanism. It constructs a query, sends it to the
- local server, awaits a response, and makes preliminary
- checks on the reply. The query requests information of
- the specified _t_y_p_e and _c_l_a_s_s for the specified fully-
- qualified domain name _d_n_a_m_e _. The reply message is left
- in the _a_n_s_w_e_r buffer with length _a_n_s_l_e_n supplied by the
- caller.
-
- The _r_e_s___s_e_a_r_c_h routine makes a query and awaits a response
- like _r_e_s___q_u_e_r_y, but in addition, it implements the default
- and search rules controlled by the RES_DEFNAMES and
- RES_DNSRCH options. It returns the first successful
- reply.
-
- The remaining routines are lower-level routines used by
- _r_e_s___q_u_e_r_y. The _r_e_s___m_k_q_u_e_r_y function constructs a standard
- query message and places it in _b_u_f. It returns the size
- of the query, or -1 if the query is larger than _b_u_f_l_e_n.
- The query type _o_p is usually QUERY, but can be any of the
- query types defined in _<_a_r_p_a_/_n_a_m_e_s_e_r_._h_>. The domain name
- for the query is given by _d_n_a_m_e. _N_e_w_r_r is currently
- unused but is intended for making update messages.
-
- The _r_e_s___s_e_n_d routine sends a pre-formatted query and
- returns an answer. It will call _r_e_s___i_n_i_t if RES_INIT is
- not set, send the query to the local name server, and han-
- dle timeouts and retries. The length of the reply message
- is returned, or -1 if there were errors.
-
-
-
-
- November 11, 1993 3
-
-
-
-
-
- RESOLVER(3) RESOLVER(3)
-
-
- The _d_n___c_o_m_p function compresses the domain name _e_x_p___d_n and
- stores it in _c_o_m_p___d_n. The size of the compressed name is
- returned or -1 if there were errors. The size of the
- array pointed to by _c_o_m_p___d_n is given by _l_e_n_g_t_h. The com-
- pression uses an array of pointers _d_n_p_t_r_s to previously-
- compressed names in the current message. The first
- pointer points to to the beginning of the message and the
- list ends with NULL. The limit to the array is specified
- by _l_a_s_t_d_n_p_t_r. A side effect of _d_n___c_o_m_p is to update the
- list of pointers for labels inserted into the message as
- the name is compressed. If _d_n_p_t_r is NULL, names are not
- compressed. If _l_a_s_t_d_n_p_t_r is NULL, the list of labels is
- not updated.
-
- The _d_n___e_x_p_a_n_d entry expands the compressed domain name
- _c_o_m_p___d_n to a full domain name The compressed name is con-
- tained in a query or reply message; _m_s_g is a pointer to
- the beginning of the message. The uncompressed name is
- placed in the buffer indicated by _e_x_p___d_n which is of size
- _l_e_n_g_t_h. The size of compressed name is returned or -1 if
- there was an error.
-
- FFIILLEESS
- /etc/resolv.conf see resolver(5)
-
- SSEEEE AALLSSOO
- gethostbyname(3), named(8), resolver(5), hostname(7),
- RFC1032, RFC1033, RFC1034, RFC1035, RFC974,
- SMM:11 Name Server Operations Guide for BIND
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- November 11, 1993 4
-
-
-